﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Winz.FoeBot;
using Winz.JsonModel;

using System.Data.Entity;

namespace Winz.FoeBot.DataLayer
{
    public class FoeDbInitializer : DropCreateDatabaseIfModelChanges <FoeContext>
    {
        public void SeedPublic(FoeContext context)
        {
            IList<GoodTranslation> translations = new List<GoodTranslation>();

            translations.Add(new GoodTranslation() { GoodId = "alabaster", Translation = "Marbre", Era = "BronzeAge" });
            translations.Add(new GoodTranslation() { GoodId = "asbestos", Translation = "Amiante", Era = "ProgressiveEra" });
            translations.Add(new GoodTranslation() { GoodId = "basalt", Translation = "Basalte", Era = "LateMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "brass", Translation = "Laiton", Era = "LateMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "brick", Translation = "Brique", Era = "HighMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "bronze", Translation = "Cuivre", Era = "EarlyMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "cloth", Translation = "Tissu", Era = "IronAge" });
            translations.Add(new GoodTranslation() { GoodId = "coffee", Translation = "Café", Era = "ColonialAge" });
            translations.Add(new GoodTranslation() { GoodId = "coke", Translation = "Coke", Era = "IndustrialAge" });
            translations.Add(new GoodTranslation() { GoodId = "cypress", Translation = "Bois", Era = "BronzeAge" });
            translations.Add(new GoodTranslation() { GoodId = "dye", Translation = "Teinture", Era = "BronzeAge" });
            translations.Add(new GoodTranslation() { GoodId = "ebony", Translation = "Bois d ebene", Era = "IronAge" });
            translations.Add(new GoodTranslation() { GoodId = "explosives", Translation = "Explosifs", Era = "ProgressiveEra" });
            translations.Add(new GoodTranslation() { GoodId = "fertilizer", Translation = "Engrais", Era = "IndustrialAge" });
            translations.Add(new GoodTranslation() { GoodId = "gems", Translation = "Bijoux", Era = "IronAge" });
            translations.Add(new GoodTranslation() { GoodId = "glass", Translation = "Verre", Era = "HighMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "gold", Translation = "Or", Era = "EarlyMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "granite", Translation = "Granite", Era = "EarlyMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "gunpowder", Translation = "Poudre à canon", Era = "LateMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "herbs", Translation = "Herbes", Era = "HighMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "honey", Translation = "Miel", Era = "EarlyMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "lead", Translation = "Fer", Era = "IronAge" });
            translations.Add(new GoodTranslation() { GoodId = "limestone", Translation = "Calcaire", Era = "IronAge" });
            translations.Add(new GoodTranslation() { GoodId = "machineparts", Translation = "Pieces détachées", Era = "ProgressiveEra" });
            translations.Add(new GoodTranslation() { GoodId = "marble", Translation = "Albatre", Era = "EarlyMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "paper", Translation = "Papier", Era = "ColonialAge" });
            translations.Add(new GoodTranslation() { GoodId = "petroleum", Translation = "Essence", Era = "ProgressiveEra" });
            translations.Add(new GoodTranslation() { GoodId = "porcelain", Translation = "Porcelaine", Era = "ColonialAge" });
            translations.Add(new GoodTranslation() { GoodId = "ropes", Translation = "Cordes", Era = "HighMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "rubber", Translation = "Caoutchouc", Era = "IndustrialAge" });
            translations.Add(new GoodTranslation() { GoodId = "salt", Translation = "Sel", Era = "HighMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "sandstone", Translation = "Pierre", Era = "BronzeAge" });
            translations.Add(new GoodTranslation() { GoodId = "silk", Translation = "Soie", Era = "LateMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "talc", Translation = "Poudre à talquer", Era = "LateMiddleAge" });
            translations.Add(new GoodTranslation() { GoodId = "tar", Translation = "Goudron", Era = "ColonialAge" });
            translations.Add(new GoodTranslation() { GoodId = "textiles", Translation = "Textiles", Era = "IndustrialAge" });
            translations.Add(new GoodTranslation() { GoodId = "tinplate", Translation = "Fer-Blanc", Era = "ProgressiveEra" });
            translations.Add(new GoodTranslation() { GoodId = "whaleoil", Translation = "Huille de baleine", Era = "IndustrialAge" });
            translations.Add(new GoodTranslation() { GoodId = "wine", Translation = "Vin", Era = "BronzeAge" });
            translations.Add(new GoodTranslation() { GoodId = "wire", Translation = "Fil", Era = "ColonialAge" });

            if (context.GoodTranslations.Count() == 0)
                foreach (GoodTranslation t in translations)
                {
                    context.GoodTranslations.Add(t);
                }
            context.SaveChanges();

        }

        protected override void Seed(FoeContext context)
        {
            SeedPublic(context);

            //All standards will
            base.Seed(context);
        }
    }
}
